/**
 * 	write on 2005-10-27 1:24:09.
 */
package org.nanhill.xmlro.gsp;

import java.io.Reader;
import java.util.HashMap;
import java.util.Map;

import org.nanhill.xmlro.XmlroException;

/**
 * Gsp version 2.0
 * 
 * @author alin
 * 
 */
public class GspInputV2<E> extends GspInput<E> {

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.nanhill.protocol.xmlro.input.Input#parseXml(java.io.Reader)
	 */
	public GspInputV2(Reader reader) throws XmlroException {
		super(reader);
	}

	public GspInputV2() {
		super();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.nanhill.xmlro.XmlroInput#readMap()
	 */
	public Object readMap() throws XmlroException {
		next();
		Map<String, Object> map = new HashMap<String, Object>();
		while (false == canEndParseMap()) {
			String key = this.nodeName();
			next();
			Object value = parse();
			map.put(key, value);
			next();
		}
		assertMapEndTag();
		next();
		return map;
	}

}
